package com.xindz.hgq.adapter;

import android.graphics.Bitmap;
import android.support.annotation.Nullable;
import android.view.View;
import android.widget.ImageView;

import com.blankj.utilcode.util.ConvertUtils;
import com.chad.library.adapter.base.BaseQuickAdapter;
import com.chad.library.adapter.base.BaseViewHolder;
import com.xindz.hgq.R;
import com.xindz.hgq.database.greendao.bean.LztxBean;

import java.util.List;

/**
 * @name HGQBase
 * @class name：com.xindz.hgq.title
 * @describe describe
 * @anthor XINDZ
 * @time 2018/1/12 16:06
 * @change
 * @chang time
 * @class describe
 */
public class LZTXShowAdapter extends BaseQuickAdapter<LztxBean, BaseViewHolder> {
    public LZTXShowAdapter(int layoutResId, @Nullable List<LztxBean> data) {
        super(layoutResId, data);
    }

    @Override
    protected void convert(BaseViewHolder helper, LztxBean item) {
        String sb = "String:" + item.getObjectId() + "\n" +
                "Byte:" + item.getAByte() + "\n" +
                "Short:" + item.getAShort() + "\n" +
                "Integer:" + item.getAInteger() + "\n" +
                "Long" + item.getALong() + "\n" +
                "Boolean" + item.getABoolean() + "\n" +
                "list:" + item.getAlist().toString();
        helper.setText(R.id.tv_gd_v2, sb);
        byte[] abyteArray = item.getAbyteArray();
        Bitmap bitmap = ConvertUtils.bytes2Bitmap(abyteArray);
        ImageView iv = helper.getView(R.id.iv_gd_v2);
        iv.setImageBitmap(bitmap);
        bitmap = null;

    }
}
